print-operation: Be more robust in the error path
authorDebarshi Ray <debarshir@gnome.org>
Wed, 16 Mar 2016 01:18:24 +0000 (02:18 +0100)
committerDebarshi Ray <debarshir@gnome.org>
Mon, 21 Mar 2016 15:09:30 +0000 (16:09 +0100)
This isn't an issue at the moment. Only exporting to a file can fail
by setting by setting an error and it happens to correctly return
GTK_PRINT_OPERATION_RESULT_ERROR regardless of this code.

Still, let's make this block of code more correct to prevent future
changes from introducing broken behaviour.

https://bugzilla.gnome.org/show_bug.cgi?id=763731

gtk/gtkprintoperation.c

index 9f4540b0f122275a5cce7d77193cb96b2ebd58df..db53d050cc7c7ac56cb585c66cdda493dc371d03 100644 (file)
@@ -3283,9 +3283,10 @@ gtk_print_operation_run (GtkPrintOperation        *op,
   if (run_print_pages)
     print_pages (op, parent, do_print, result);
 
-  if (priv->error && error)
+  if (priv->error)
     {
-      *error = g_error_copy (priv->error);
+      if (error)
+        *error = g_error_copy (priv->error);
       result = GTK_PRINT_OPERATION_RESULT_ERROR;
     }
   else if (priv->cancelled)